package javaee.synchronize;

/**
 * @author tongchen
 * @create 2023-06-15 22:00
 */
public class SynchronizedTesting {
    public static int count=0;
    public static void main(String[] args) throws InterruptedException {
         Thread thread1 =new Thread(()->{
             for (int i=0;i<50000;++i){
                 increase();
             }
                 });
         thread1.start();
         for(int i=0;i<50000;++i){
             increase();
         }
         Thread thread2 =new Thread(()->{
                    increase();
                 });
//        thread2.start();
         thread1.join();
//         thread2.join();
        System.out.println(count);
    }
    public synchronized static void increase(){
        count++;
    }
}
